package com.kaibes.core.base.util;

public class ArrayUtils {

    public static boolean isEmpty(Object[] objs) {
        return objs == null || objs.length == 0;
    }
    public static boolean isEmpty(byte[] objs) {
        return objs == null || objs.length == 0;
    }
    
    public static boolean isNotEmpty(Object[] objs) {
        return objs != null && objs.length > 0;
    }
    
    public static boolean isEmptyOrStartsWith(Object[] sources, Object...objs) {
        if (isEmpty(sources)) {
            return true;
        }
        for (Object object : objs) {
            return sources[0] == object;
        }
        return false;
    }
    public static boolean isEmptyOrStartsWith(byte[] sources, char...objs) {
        if (sources == null || sources.length == 0) {
            return true;
        }
        for (char object : objs) {
            return sources[0] == object;
        }
        return false;
    }
    
    public static String[] combineArray(String[] arr_1, String[] arr_2) {
        String[] arr = new String[arr_1.length+arr_2.length];
        System.arraycopy(arr_1, 0, arr, 0, arr_1.length);
        System.arraycopy(arr_2, 0, arr, arr_1.length, arr_2.length);
        return arr;
    }
    public static int[] combineArray(int[] arr_1, int[] arr_2) {
        int[] arr = new int[arr_1.length+arr_2.length];
        System.arraycopy(arr_1, 0, arr, 0, arr_1.length);
        System.arraycopy(arr_2, 0, arr, arr_1.length, arr_2.length);
        return arr;
    }
    public static byte[] combineArray(byte[] arr_1, byte[] arr_2) {
        byte[] arr = new byte[arr_1.length+arr_2.length];
        System.arraycopy(arr_1, 0, arr, 0, arr_1.length);
        System.arraycopy(arr_2, 0, arr, arr_1.length, arr_2.length);
        return arr;
    }
    
}
